package gemini.castor.ui.client.page.content.account.mysponsor.form;

import gemini.basic.model.Distributor;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiTemplate;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.Widget;

public class MySponsorFormView extends Composite implements
		MySponsorFormPresenter.Display {

	@UiTemplate("MySponsorFormView.ui.xml")
	interface MyUiBinder extends UiBinder<Panel, MySponsorFormView> {
	}

	private static final MyUiBinder binder = GWT.create(MyUiBinder.class);
	public MySponsorFormView() {
		initWidget(binder.createAndBindUi(this));
	}

	@UiField
	HTML htmSponsorFullName;

	@UiField
	HTML htmSponsorIDInfo;

	@UiField
	HTML htmSponsorPhone;

	private Distributor distributor;

	@Override
	public Widget asWidget() {
		return this;
	}

	@Override
	public void loadData() {
		htmSponsorFullName.setText(distributor.getPersons().get(0).getFirstName()+" "+distributor.getPersons().get(0).getLastName());
		htmSponsorIDInfo.setText(distributor.getCode());
		htmSponsorPhone.setText(distributor.getPersons().get(0).getPhoneNumber());
	}

	@Override
	public void setDistributorSponsor(Distributor distributor) {
		this.distributor = distributor;
		
	}
}
